import React, { useEffect, useState } from 'react'
let timer
function Test2() {
  const [count, setCount] = useState(60)
  let a = count
  useEffect(() => {
    timer = setInterval(() => {
      setCount(a--)
    }, 1000)
    return () => clearInterval(timer)
  }, [])

  return <div>{count}</div>
}

export default Test2
